<!DOCTYPE html>






<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />


















  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon.ico?v=5.1.3">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico?v=5.1.3">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico?v=5.1.3">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.3" color="#222">





  <meta name="keywords" content="Hexo,theme-next," />










<meta name="description" content="阅前须知 安装Git和Node Node Git   注册支持Pages的Git仓库账号一枚 github gitee">
<meta name="keywords" content="Hexo,theme-next">
<meta property="og:type" content="article">
<meta property="og:title" content="使用Hexo + Next搭建博客">
<meta property="og:url" content="https://zhangyuhan2016.gitee.io/2017/12/08/Hexo&Next/index.html">
<meta property="og:site_name" content="zhangyuhan2016">
<meta property="og:description" content="阅前须知 安装Git和Node Node Git   注册支持Pages的Git仓库账号一枚 github gitee">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-10-29T06:46:12.016Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用Hexo + Next搭建博客">
<meta name="twitter:description" content="阅前须知 安装Git和Node Node Git   注册支持Pages的Git仓库账号一枚 github gitee">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.3',
    sidebar: {"position":"right","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://zhangyuhan2016.gitee.io/2017/12/08/Hexo&Next/"/>





  <title>使用Hexo + Next搭建博客 | zhangyuhan2016</title>









</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<header style="position: fixed;z-index: 99999999;background-color: #eee;width: 100%;text-align: center;">
    <h3>感谢您的关注，最新博客已迁移至 <mark style="background-color: #07c160;padding: 4px;"><a style="color: #fff;" href="https://blog.hi-zhang.com" target="_blank">blog.hi-zhang.com</a></mark> </h3>
</header>






  <div class="container sidebar-position-right page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">


    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">zhangyuhan2016</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>

        <p class="site-subtitle"></p>

  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">



    <ul id="menu" class="menu">


        <li class="menu-item menu-item-home">
          <a href="/" rel="section">

              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />

            首页
          </a>
        </li>


        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">

              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />

            标签
          </a>
        </li>


        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">

              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />

            归档
          </a>
        </li>



    </ul>



</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">


  <div id="posts" class="posts-expand">








  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">



  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://zhangyuhan2016.gitee.io/2017/12/08/Hexo&Next/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="zhangyuhan2016">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://avatars3.githubusercontent.com/u/18086072?s=460&v=4">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="zhangyuhan2016">
    </span>


      <header class="post-header">



          <h1 class="post-title" itemprop="name headline">使用Hexo + Next搭建博客</h1>


        <div class="post-meta">
          <span class="post-time">

              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>

                <span class="post-meta-item-text">发表于</span>

              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-12-08T16:32:32+08:00">
                2017-12-08
              </time>



              <span class="post-meta-divider">|</span>



              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>

                <span class="post-meta-item-text">更新于&#58;</span>

              <time title="更新于" itemprop="dateModified" datetime="2018-10-29T14:46:12+08:00">
                2018-10-29
              </time>

          </span>





              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/12/08/Hexo&Next/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count"
                        data-disqus-identifier="2017/12/08/Hexo&Next/" itemprop="commentCount"></span>
                </a>
              </span>





             <span id="/2017/12/08/Hexo&Next/" class="leancloud_visitors" data-flag-title="使用Hexo + Next搭建博客">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>

                 <span class="post-meta-item-text">阅读次数&#58;</span>

                 <span class="leancloud-visitors-count"></span>
             </span>





            <div class="post-wordcount">


                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>

                  <span class="post-meta-item-text">字数统计&#58;</span>

                <span title="字数统计">
                  732
                </span>



                <span class="post-meta-divider">|</span>



                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>

                  <span class="post-meta-item-text">阅读时长 &asymp;</span>

                <span title="阅读时长">
                  3
                </span>

            </div>




        </div>
      </header>





    <div class="post-body" itemprop="articleBody">





        <h2 id="阅前须知"><a href="#阅前须知" class="headerlink" title="阅前须知"></a>阅前须知</h2><ul>
<li><a href="https://www.baidu.com/s?wd=%E5%AE%89%E8%A3%85git%E5%92%8Cnode" target="_blank" rel="noopener">安装Git和Node</a><ul>
<li>Node</li>
<li>Git</li>
</ul>
</li>
<li>注册支持Pages的Git仓库账号一枚<ul>
<li><a href="https://github.com/" target="_blank" rel="noopener">github</a></li>
<li><a href="https://gitee.com/" target="_blank" rel="noopener">gitee</a></li>
</ul>
</li>
</ul>
<a id="more"></a>
<h2 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h2><ul>
<li><a href="https://hexo.io/zh-cn/docs/index.html" target="_blank" rel="noopener">如何安装Hexo</a></li>
<li>相关命令  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br><span class="line">hexo init myBolg</span><br><span class="line">cd myBolg</span><br><span class="line">npm install</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="部署至Pages"><a href="#部署至Pages" class="headerlink" title="部署至Pages"></a>部署至Pages</h2><h3 id="生成静态文件"><a href="#生成静态文件" class="headerlink" title="生成静态文件"></a>生成静态文件</h3>  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo g</span><br></pre></td></tr></table></figure>
<h3 id="推送到Git仓库-推荐使用第二种方式"><a href="#推送到Git仓库-推荐使用第二种方式" class="headerlink" title="推送到Git仓库(推荐使用第二种方式)"></a>推送到Git仓库(推荐使用第二种方式)</h3><ol>
<li><p>手动推送刚才生成的public文件夹内的文件<br>这个相对比较简单</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">git add .</span><br><span class="line">git commit -m &quot;start&quot;</span><br><span class="line">git push</span><br></pre></td></tr></table></figure>
</li>
<li><p>安装插件 <a href="https://github.com/hexojs/hexo-deployer-git" target="_blank" rel="noopener">hexo-deployer-git</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>
<p>打开配置文件_config.yml<br>修改相关配置</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo: https://gitee.com/zhangyuhan2016/zhangyuhan2016.git</span><br><span class="line">  branch: master</span><br></pre></td></tr></table></figure>
<p>上传</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo d</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="安装Next主题"><a href="#安装Next主题" class="headerlink" title="安装Next主题"></a><a href="http://theme-next.iissnan.com/getting-started.html" target="_blank" rel="noopener">安装Next主题</a></h2><p>  在项目目录下执行clone命令,会在themes目录下添加next主题<br>  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https://github.com/iissnan/hexo-theme-next themes/next</span><br></pre></td></tr></table></figure></p>
<p>  打开配置文件_config.yml<br>  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">theme: next</span><br></pre></td></tr></table></figure></p>
<h3 id="安装插件"><a href="#安装插件" class="headerlink" title="安装插件"></a>安装插件</h3><p>  1.<a href="http://theme-next.iissnan.com/third-party-services.html" target="_blank" rel="noopener">官方集成的第三方服务</a>    </p>
<h2 id="扩展"><a href="#扩展" class="headerlink" title="扩展"></a>扩展</h2><h3 id="显示文件更新时间"><a href="#显示文件更新时间" class="headerlink" title="显示文件更新时间"></a>显示文件更新时间</h3><p>  打开主题配置文件，找到<code>updated_at</code>修改为true<br>  如果需要置顶和按文件更新时间排序<a href="https://github.com/YuyingWu/hexo-generator-index-plus" target="_blank" rel="noopener">你可以试试这个插件</a></p>
<h3 id="npm-scripts"><a href="#npm-scripts" class="headerlink" title="npm scripts"></a><a href="https://www.zybuluo.com/yangfch3/note/249328" target="_blank" rel="noopener">npm scripts</a></h3><p>  使用npm scripts 来整合命令<br>  <strong>package.json</strong><br>  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&quot;scripts&quot;: &#123;</span><br><span class="line">    &quot;upGit&quot;: &quot;hexo clean &amp;&amp; hexo g &amp;&amp; hexo d&quot;</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure></p>
  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">npm run upGit</span><br><span class="line">等价于</span><br><span class="line">hexo clean</span><br><span class="line">hexo g</span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure>
<h3 id="改变主题的一些布局"><a href="#改变主题的一些布局" class="headerlink" title="改变主题的一些布局"></a>改变主题的一些布局</h3><p>  通过修改<strong>themes/next/layout</strong>内的代码可以改变布局<br>  把下面的网易云音乐的外链代码放入<strong>themes/next/layout/_custom/sidebar.swig</strong>,就可以在侧边栏看到<br>  <figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">iframe</span> <span class="attr">frameborder</span>=<span class="string">"no"</span> <span class="attr">border</span>=<span class="string">"0"</span> <span class="attr">marginwidth</span>=<span class="string">"0"</span> <span class="attr">marginheight</span>=<span class="string">"0"</span> <span class="attr">width</span>=<span class="string">298</span> <span class="attr">height</span>=<span class="string">52</span> <span class="attr">src</span>=<span class="string">"//music.163.com/outchain/player?type=2&amp;id=474922552&amp;auto=0&amp;height=32"</span>&gt;</span><span class="tag">&lt;/<span class="name">iframe</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>  同样也可以在markdown文章中插入这些代码<br>  <figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">aside</span> <span class="attr">style</span>=<span class="string">"max-width: 280px;border-radius: 10px;box-shadow: inset 0 0 8px 2px #9c9c9c;"</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">iframe</span>  <span class="attr">frameborder</span>=<span class="string">"no"</span> <span class="attr">border</span>=<span class="string">"0"</span> <span class="attr">marginwidth</span>=<span class="string">"0"</span> <span class="attr">marginheight</span>=<span class="string">"0"</span> <span class="attr">width</span>=<span class="string">330</span> <span class="attr">height</span>=<span class="string">86</span> <span class="attr">src</span>=<span class="string">"//music.163.com/outchain/player?type=2&amp;id=29759733&amp;auto=0&amp;height=66"</span>&gt;</span><span class="tag">&lt;/<span class="name">iframe</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">aside</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>  <aside style="max-width: 280px;border-radius: 10px;box-shadow: inset 0 0 8px 2px #9c9c9c;"><iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="86" src="//music.163.com/outchain/player?type=2&id=29759733&auto=0&height=66"></iframe></aside><br>  同样进入<strong>themes/next/source/css</strong>修改或加入新的样式<br>  next主题使用的icon <a href="https://fontawesome.com/icons?d=gallery&amp;m=free" target="_blank" rel="noopener">fontawesome</a></p>
<h3 id="制作Hexo主题"><a href="#制作Hexo主题" class="headerlink" title="制作Hexo主题"></a><a href="https://cn.bing.com/search?q=hexo+%E4%B8%BB%E9%A2%98%E5%88%B6%E4%BD%9C" target="_blank" rel="noopener">制作Hexo主题</a></h3><h3 id="添加留言评论功能-valine"><a href="#添加留言评论功能-valine" class="headerlink" title="添加留言评论功能 valine"></a><a href="https://cn.bing.com/search?q=valine+next" target="_blank" rel="noopener">添加留言评论功能 valine</a></h3><p>  其实实现留言的方案有很多,大多都是通过一些免费的云服务实现,如果想自己实现,推荐一下<a href="https://www.wilddog.com/" target="_blank" rel="noopener">野狗云</a>,</p>
<p>  我这边选择了<a href="https://valine.js.org/#/hexo?id=hexo-theme-next" target="_blank" rel="noopener">valine</a> 来实现<br>  (半年后)这边是自己悄咪咪的实现了个<a href="https://github.com/zhangyuhan2016/wilddog-discuss" target="_blank" rel="noopener">基于野狗云的留言插件</a>_</p>
<h3 id="备份配置和文章"><a href="#备份配置和文章" class="headerlink" title="备份配置和文章"></a>备份配置和文章</h3><p>  备份的方式有很多,如果使用git进行备份,需要分别备份hexo和next主题</p>
<h3 id="一些问题"><a href="#一些问题" class="headerlink" title="一些问题"></a>一些问题</h3><pre><code>warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF
</code></pre><p>  在提交的时候出现了这些警告,虽然不影响提交,但是也不愿意看到.<br>  这是什么原因呢,原来是因为Git的换行符检查功能。<a href="http://blog.csdn.net/feng88724/article/details/11600375" target="_blank" rel="noopener">详解</a></p>
<p>  我选择使用了在Windows系统上的签出文件中保留CRLF，会在Mac和Linux系统上，包括仓库中保留LF。<br>  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git config --global core.autocrlf input</span><br></pre></td></tr></table></figure></p>


    </div>







      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div></div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">




      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/zfb.png" alt="zhangyuhan2016 支付宝"/>
        <p>支付宝</p>
      </div>




  </div>
</div>

      </div>




    <footer class="post-footer">

        <div class="post-tags">

            <a href="/tags/Hexo/" rel="tag">Hexo</a>

            <a href="/tags/theme-next/" rel="tag">theme-next</a>

        </div>







        <div class="post-nav">
          <div class="post-nav-next post-nav-item">

          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">

              <a href="/2017/12/12/WebStorm-note/" rel="prev" title="WebStorm备忘">
                WebStorm备忘 <i class="fa fa-chevron-right"></i>
              </a>

          </div>
        </div>




    </footer>
  </div>



  </article>



    <div class="post-spread">

    </div>
  </div>


          </div>






    <div class="comments" id="comments">
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    </div>





        </div>



  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">

    <div class="sidebar-inner">




        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>


      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">

              <img class="site-author-image" itemprop="image"
                src="https://avatars3.githubusercontent.com/u/18086072?s=460&v=4"
                alt="zhangyuhan2016" />

              <p class="site-author-name" itemprop="name">zhangyuhan2016</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">


              <div class="site-state-item site-state-posts">

                <a href="/archives/">

                  <span class="site-state-item-count">15</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>







              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">30</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>


          </nav>



          <div class="links-of-author motion-element">


                <span class="links-of-author-item">
                  <a href="https://github.com/zhangyuhan2016" target="_blank" title="GitHub">

                      <i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>


          </div>








        </div>
      </section>


      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">






              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#阅前须知"><span class="nav-number">1.</span> <span class="nav-text"><a href="#&#x9605;&#x524D;&#x987B;&#x77E5;" class="headerlink" title="&#x9605;&#x524D;&#x987B;&#x77E5;"></a>&#x9605;&#x524D;&#x987B;&#x77E5;</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装Hexo"><span class="nav-number">2.</span> <span class="nav-text"><a href="#&#x5B89;&#x88C5;Hexo" class="headerlink" title="&#x5B89;&#x88C5;Hexo"></a>&#x5B89;&#x88C5;Hexo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#部署至Pages"><span class="nav-number">3.</span> <span class="nav-text"><a href="#&#x90E8;&#x7F72;&#x81F3;Pages" class="headerlink" title="&#x90E8;&#x7F72;&#x81F3;Pages"></a>&#x90E8;&#x7F72;&#x81F3;Pages</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#生成静态文件"><span class="nav-number">3.1.</span> <span class="nav-text"><a href="#&#x751F;&#x6210;&#x9759;&#x6001;&#x6587;&#x4EF6;" class="headerlink" title="&#x751F;&#x6210;&#x9759;&#x6001;&#x6587;&#x4EF6;"></a>&#x751F;&#x6210;&#x9759;&#x6001;&#x6587;&#x4EF6;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#推送到Git仓库-推荐使用第二种方式"><span class="nav-number">3.2.</span> <span class="nav-text"><a href="#&#x63A8;&#x9001;&#x5230;Git&#x4ED3;&#x5E93;-&#x63A8;&#x8350;&#x4F7F;&#x7528;&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x5F0F;" class="headerlink" title="&#x63A8;&#x9001;&#x5230;Git&#x4ED3;&#x5E93;(&#x63A8;&#x8350;&#x4F7F;&#x7528;&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x5F0F;)"></a>&#x63A8;&#x9001;&#x5230;Git&#x4ED3;&#x5E93;(&#x63A8;&#x8350;&#x4F7F;&#x7528;&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x5F0F;)</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装Next主题"><span class="nav-number">4.</span> <span class="nav-text"><a href="#&#x5B89;&#x88C5;Next&#x4E3B;&#x9898;" class="headerlink" title="&#x5B89;&#x88C5;Next&#x4E3B;&#x9898;"></a><a href="http://theme-next.iissnan.com/getting-started.html" target="_blank" rel="noopener">&#x5B89;&#x88C5;Next&#x4E3B;&#x9898;</a></span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#安装插件"><span class="nav-number">4.1.</span> <span class="nav-text"><a href="#&#x5B89;&#x88C5;&#x63D2;&#x4EF6;" class="headerlink" title="&#x5B89;&#x88C5;&#x63D2;&#x4EF6;"></a>&#x5B89;&#x88C5;&#x63D2;&#x4EF6;</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#扩展"><span class="nav-number">5.</span> <span class="nav-text"><a href="#&#x6269;&#x5C55;" class="headerlink" title="&#x6269;&#x5C55;"></a>&#x6269;&#x5C55;</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#显示文件更新时间"><span class="nav-number">5.1.</span> <span class="nav-text"><a href="#&#x663E;&#x793A;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x65F6;&#x95F4;" class="headerlink" title="&#x663E;&#x793A;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x65F6;&#x95F4;"></a>&#x663E;&#x793A;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x65F6;&#x95F4;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#npm-scripts"><span class="nav-number">5.2.</span> <span class="nav-text"><a href="#npm-scripts" class="headerlink" title="npm scripts"></a><a href="https://www.zybuluo.com/yangfch3/note/249328" target="_blank" rel="noopener">npm scripts</a></span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#改变主题的一些布局"><span class="nav-number">5.3.</span> <span class="nav-text"><a href="#&#x6539;&#x53D8;&#x4E3B;&#x9898;&#x7684;&#x4E00;&#x4E9B;&#x5E03;&#x5C40;" class="headerlink" title="&#x6539;&#x53D8;&#x4E3B;&#x9898;&#x7684;&#x4E00;&#x4E9B;&#x5E03;&#x5C40;"></a>&#x6539;&#x53D8;&#x4E3B;&#x9898;&#x7684;&#x4E00;&#x4E9B;&#x5E03;&#x5C40;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#制作Hexo主题"><span class="nav-number">5.4.</span> <span class="nav-text"><a href="#&#x5236;&#x4F5C;Hexo&#x4E3B;&#x9898;" class="headerlink" title="&#x5236;&#x4F5C;Hexo&#x4E3B;&#x9898;"></a><a href="https://cn.bing.com/search?q=hexo+%E4%B8%BB%E9%A2%98%E5%88%B6%E4%BD%9C" target="_blank" rel="noopener">&#x5236;&#x4F5C;Hexo&#x4E3B;&#x9898;</a></span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#添加留言评论功能-valine"><span class="nav-number">5.5.</span> <span class="nav-text"><a href="#&#x6DFB;&#x52A0;&#x7559;&#x8A00;&#x8BC4;&#x8BBA;&#x529F;&#x80FD;-valine" class="headerlink" title="&#x6DFB;&#x52A0;&#x7559;&#x8A00;&#x8BC4;&#x8BBA;&#x529F;&#x80FD; valine"></a><a href="https://cn.bing.com/search?q=valine+next" target="_blank" rel="noopener">&#x6DFB;&#x52A0;&#x7559;&#x8A00;&#x8BC4;&#x8BBA;&#x529F;&#x80FD; valine</a></span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#备份配置和文章"><span class="nav-number">5.6.</span> <span class="nav-text"><a href="#&#x5907;&#x4EFD;&#x914D;&#x7F6E;&#x548C;&#x6587;&#x7AE0;" class="headerlink" title="&#x5907;&#x4EFD;&#x914D;&#x7F6E;&#x548C;&#x6587;&#x7AE0;"></a>&#x5907;&#x4EFD;&#x914D;&#x7F6E;&#x548C;&#x6587;&#x7AE0;</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#一些问题"><span class="nav-number">5.7.</span> <span class="nav-text"><a href="#&#x4E00;&#x4E9B;&#x95EE;&#x9898;" class="headerlink" title="&#x4E00;&#x4E9B;&#x95EE;&#x9898;"></a>&#x4E00;&#x4E9B;&#x95EE;&#x9898;</span></a></li></ol></li></ol></div>


          </div>
        </section>
      <!--/noindex-->




    </div>
    <div class="post-block page my-thanks">
        <div class="my-title">致谢</div>
        <div class="thanks">Hexo</div>
        <div class="thanks">Next & Gemini</div>
        <div class="thanks">Gitee</div>
    </div>
  </aside>



      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">









      </div>
    </footer>


      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>

      </div>




  </div>



<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>



























    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>




    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>




    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>




    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>




    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>




    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>




    <script type="text/javascript" src="/lib/three/three.min.js"></script>




    <script type="text/javascript" src="/lib/three/canvas_lines.min.js"></script>






  <script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script>







  <script type="text/javascript" src="/js/src/affix.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.3"></script>




  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.3"></script>






  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script>









      <script id="dsq-count-scr" src="https://.disqus.com/count.js" async></script>



      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'https://zhangyuhan2016.gitee.io/2017/12/08/Hexo&Next/';
          this.page.identifier = '2017/12/08/Hexo&Next/';
          this.page.title = '使用Hexo + Next搭建博客';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>






























  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>

  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: true,
        notify: false,
        appId: 'xxTmc7jwpAd2bWhmkKOI7IGY-gzGzoHsz',
        appKey: 'glPUiD8ljbJsKYhBg5E0ghII',
        placeholder: '说点什么呗 ヾﾉ≧∀≦)o',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>












  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("mpOMyFHLi7a5S0ka5mv3cz7C-gzGzoHsz", "3t0W0au9Mxf0lOGFDF8u89pc");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>
















</body>
</html>
